PROJECT(OgreBindings)

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

## If you get errors about not finding swig, set this:
#SET(SWIG_DIR /usr/local/bin)

#SET(INTERFACE_FILES OgreNet/OgreBindings.i OgreNet/OgreBindings_Compositor.i OgreNet/OgreBindings_DotSceneOctreeHelper.i)
SET(INTERFACE_FILES OgreNet/OgreBindings.i)
SET(SRC_FILES "")

SET(LIBRARY_OUTPUT_PATH bin)
SET(EXECUTABLE_OUTPUT_PATH bin)

FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

IF(APPLE)
  FIND_LIBRARY(OGRE_LIBRARY Ogre)
  FIND_PATH(OGRE_INCLUDE_DIR Ogre/Ogre.h)

  FIND_LIBRARY(CARBON_LIBRARY Carbon)
  FIND_PATH(CARBON_INCLUDE_DIR Carbon/Carbon.h)

  SET(EXTRA_INCLUDES ${EXTRA_INCLUDES}
    ${OGRE_INCLUDE_DIR}/Headers
    ${CARBON_INCLUDE_DIR}/Headers)

  SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES}
    ${OGRE_LIBRARY}
    ${CARBON_LIBRARY})
ELSEIF(WIN32)
  FIND_LIBRARY(OGRE_LIBRARY OgreMain)
  FIND_PATH(OGRE_INCLUDE_DIR Ogre.h)

  SET(EXTRA_INCLUDES ${EXTRA_INCLUDES}
    ${OGRE_INCLUDE_DIR})

  SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES}
    ${OGRE_LIBRARY})
ELSE(APPLE)
  FIND_LIBRARY(OGRE_LIBRARY OgreMain)
  FIND_PATH(OGRE_INCLUDE_DIR OGRE/Ogre.h)

  SET(EXTRA_INCLUDES ${EXTRA_INCLUDES}
    ${OGRE_INCLUDE_DIR}/OGRE)

  SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES}
    ${OGRE_LIBRARY})
ENDIF(APPLE)

SET_SOURCE_FILES_PROPERTIES(${INTERFACE_FILES} PROPERTIES CPLUSPLUS ON)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/OgreNet
  ${EXTRA_INCLUDES})

IF(WIN32)
  SET(CMAKE_SWIG_FLAGS -namespace OgreDotNet)
ELSE(WIN32)
  SET(CMAKE_SWIG_FLAGS -namespace OgreDotNet -D_MONO)
ENDIF(WIN32)  

SET(CMAKE_SWIG_OUTDIR OgreNet/build)

SWIG_ADD_MODULE(OgreBindings csharp ${INTERFACE_FILES} ${SRC_FILES})
SWIG_LINK_LIBRARIES(OgreBindings ${EXTRA_LIBRARIES})
